package com.baseweb.webadmin.core.constants;

import java.util.ArrayList;
import java.util.List;

public enum AdPositionType {
    INDEX_LUNBO(1,"首页轮播广告"), LIST_AD(2,"列表页顶部"), CURRENT_RECOMMEND(3,"特别推荐"), CLASSIC_EXAMPLE(4,"经典案例"),
    INDEX_CENTER_LUNBO(5,"首页中间轮播"),INDEX_CENTER_BOTTOM(6,"首页中间底部"),INDEX_CENTER_RIGHT(7,"首页中间右侧"),
    INDEX_CEHUA(8,"首页策划师"),INDEX_ZHUCHI(9,"首页主持人"),INDEX_SHEYINGSHI(10,"首页摄影师"),INDEX_HUAZHUANGSHI(11,"首页化妆师"),
    INDEX_SHEXIANGSHI(12,"首页摄像师"),INDEX_YOULIKETOP(13,"顶部右端猜你喜欢"),INDEX_HUNLIYUYUE(14,"首页婚礼预约"),
    INDEX_HUNLIYUYUEGG(15,"首页婚礼预约广告"),INDEX_CEHUAL(16,"首页策划师左侧栏"),INDEX_CEHUAR(17,"首页策划师右侧栏"),
    INDEX_ZHUCHIL(18,"首页主持人左侧栏"),INDEX_ZHUCHIR(19,"首页主持人右侧栏"),INDEX_SHEYINGSHIL(20,"首页摄影师左侧栏"),
    INDEX_SHEYINGSHIR(21,"首页摄影师右侧栏"),INDEX_HUAZHUANGSHIL(22,"首页化妆师左侧栏"),INDEX_HUAZHUANGSHIR(23,"首页化妆师右侧栏"),
    INDEX_SHEXIANGSHIL(24,"首页摄像师左侧栏"),INDEX_SHEXIANGSHIR(25,"首页摄像师右侧栏"),INDEX_YOULIKEBOTTOM(26,"首页底部猜你喜欢");

    private int code;
    private String name;
    AdPositionType(int code, String name){
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static List<AdPositionType> getAllData(){
        List<AdPositionType> result = new ArrayList<AdPositionType>();
        for (AdPositionType current : AdPositionType.values())
        {
            result.add(current);
        }
        return result;
    }

    public static AdPositionType getNameByCode(int code){
        List<AdPositionType> allData = getAllData();
        for (AdPositionType status : allData){
            if (status.getCode() == code){
                return status;
            }
        }
        return null;
    }
    public static List<String> getAdPositionTypeOpt(){
        List<String> list = new ArrayList<>();
        for (AdPositionType current : AdPositionType.values())
        {
            String string = current.getCode() +";"+ current.getName();
            list.add(string);
        }
        return list;
    }
    public static void main(String[] args) {
        Integer t = 10;
        System.out.print(getNameByCode(t).getName());
        List<AdPositionType> list = getAllData();
        System.out.println(list.get(0).getCode());
        System.out.println(list.get(0).getName());
    }
}
